#pragma once
#include "ScanPrimitive.h"
#include "QD3D/QD3DResourcePack.h"
#include "QD3D/QD3DUtils.h"
#include <d3d11.h>

class CompactPrimitive
{
public:
	CONST_STRUCT_BEGIN(ConstVars)
		UINT totalElemNum;
	CONST_STRUCT_END

	CompactPrimitive (UINT elemNum, QD3DResourcePack *p_dataPack,
			QD3DResourcePack *p_marksPack, QD3DResourcePack *p_compactedPack,
			const std::string &structBufType,
			const std::string &customStructDeclare = "");
	~CompactPrimitive ();

	void run (UINT elemNum = -1);

private:
	UINT _elemNum;

	ID3D11Buffer *_p_totalNumDxConstBuf;

	QD3DResourcePack *_rp_dataPack;
	QD3DResourcePack *_rp_marksPack;
	QD3DResourcePack *_rp_compactedPack;

	ID3D11ComputeShader *_p_compactCS;

	ScanPrimitive *_p_scanPrimitive;

};